package com.njbw.design_pattern.struct.proxy.dynamicProxy.aop;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 全局缓存
 *
 * @author 黄侯淳
 * @since JDK 1.8
 */
public class Cache {

    private final static Map<String, String> CACHE_MAP = new ConcurrentHashMap<>();

    /**
     * 查询缓存
     *
     * @param key 缓存 key
     * @return 缓存值
     */
    public static String get(String key) {
        return CACHE_MAP.get(key);
    }

    /**
     * 放入缓存
     *
     * @param key   缓存 key
     * @param value 缓存值
     */
    public static void put(String key, String value) {
        CACHE_MAP.put(key, value);
    }
}
